﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:System="clr-namespace:System;assembly=System"
                    xmlns:local="clr-namespace:EveIntel.WpfApplication">
    
    <Color x:Key="ControlPressedColor">#FF211AA9</Color>
    <Color x:Key="DisabledControlDarkColor">#FFC5CBF9</Color>
    <Color x:Key="DisabledBorderLightColor">#FFAAAAAA</Color>
    <Color x:Key="LightGrayColor">#FFD3D3D3</Color>
    <Color x:Key="VeryLightGrayColor">#FFE8E8E8</Color>
    <Color x:Key="UltraLightGrayColor">#FFE0E0E0</Color>
    <Color x:Key="GrayBlueColor">#96B2D1</Color>
    <Color x:Key="DarkGrayBlueColor">#FF708090</Color>
    <Color x:Key="WhiteColor">#FFFFFFFF</Color>
    <Color x:Key="BlackColor">#FF000000</Color>
    <Color x:Key="RoyalBlueColor">#FF4169E1</Color>

    <SolidColorBrush x:Key="TransparentBrushKey" Color="Transparent" />
    <SolidColorBrush x:Key="WhiteBrushKey" Color="{StaticResource WhiteColor}" />
    <SolidColorBrush x:Key="DarkGrayBlueBrushKey" Color="{StaticResource DarkGrayBlueColor}" />
    <SolidColorBrush x:Key="ProgressBarForegroundBrushKey" Color="#FF4169E1"/>
    <SolidColorBrush x:Key="TopBarPathStrokeBrushKey" Color="{StaticResource BlackColor}" />
    <SolidColorBrush x:Key="TabItemCloseButtonPathStrokeBrushKey" Color="Red"  />
    <SolidColorBrush x:Key="LightGrayBrushKey" Color="{StaticResource LightGrayColor}" />
    <SolidColorBrush x:Key="VeryLightGrayBrushKey" Color="{StaticResource VeryLightGrayColor}" />
    <SolidColorBrush x:Key="UltraLightGrayBrushKey" Color="{StaticResource UltraLightGrayColor}" />
    <SolidColorBrush x:Key="GrayBlueBrushKey" Color="{StaticResource GrayBlueColor}" />
    <SolidColorBrush x:Key="RoyalBlueBrushKey" Color="{StaticResource RoyalBlueColor}"/>

    <DropShadowEffect x:Key="DropShadowEffectLight" Opacity="0.3" ShadowDepth="2"  />

    <Style x:Key="FlatRepeatButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="Transparent" Background="Transparent" CornerRadius="2">
                        <ContentPresenter
                            Margin="1"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush.Color">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource UltraLightGrayColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.3" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush.Color">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource UltraLightGrayColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush.Color">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource UltraLightGrayColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames
                                            Storyboard.TargetName="Border"
                                            Storyboard.TargetProperty="Opacity">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.5"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="HorizontalScrollViewerStyle" TargetType="{x:Type ScrollViewer}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="CanContentScroll" Value="True"/>
        <Setter Property="VerticalScrollBarVisibility" Value="Hidden"/>
        <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="Background" Value="{StaticResource TransparentBrushKey}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MaxWidth="16"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition MaxWidth="16"/>
                        </Grid.ColumnDefinitions>

                        <RepeatButton
                            x:Name="ScrollLeftButton"
                            Grid.Column="0"
                            Style="{StaticResource FlatRepeatButtonStyle}"
                            BorderThickness="0,1,1,1"
                            Margin="-1,0,0,0"
                            Command="ScrollBar.PageLeftCommand"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}">
                            <Grid>
                                <Path x:Name="DecreaseArrow" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1" Data="M 0 4 L 4 8 L 4 0 Z"/>
                            </Grid>
                        </RepeatButton>

                        <ScrollContentPresenter
                            x:Name="PART_ScrollContentPresenter"
                            Grid.Column="1"
                            Margin="{TemplateBinding Padding}"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            CanContentScroll="{TemplateBinding CanContentScroll}"/>

                        <RepeatButton
                            x:Name="ScrollRightButton"
                            Grid.Column="2"
                            Style="{StaticResource FlatRepeatButtonStyle}"
                            BorderThickness="1,1,0,1"
                            Margin="0,0,-1,0"
                            Command="ScrollBar.PageRightCommand"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}">
                            <Grid>
                                <Path x:Name="IncreaseArrow" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1" Data="M 0 8 L 4 4 L 0 0 Z"/>
                            </Grid>
                        </RepeatButton>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SearchTabControlStyle" TargetType="{x:Type TabControl}">
        <Setter Property="Control.Padding" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid KeyboardNavigation.TabNavigation="Local">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <!-- Tabs Panel -->
                        <ScrollViewer Padding="0" Style="{StaticResource HorizontalScrollViewerStyle}" >
                            <TabPanel x:Name="HeaderPanel"
                                    Margin="0,2,2,0"
                                    IsItemsHost="True"
                                    Panel.ZIndex="1"
                                    Background="{StaticResource TransparentBrushKey}"
                                    KeyboardNavigation.TabIndex="1" />
                        </ScrollViewer>
                        <!-- Content -->
                        <Border x:Name="Border"
                                Grid.Row="1"
                                Background="{StaticResource WhiteBrushKey}"
                                BorderBrush="{StaticResource UltraLightGrayBrushKey}"
                                BorderThickness="1"
                                CornerRadius="2"
                                Margin="1,0,1,1"
                                KeyboardNavigation.TabNavigation="Local"
                                KeyboardNavigation.DirectionalNavigation="Contained"
                                KeyboardNavigation.TabIndex="2">
                            <ContentPresenter 
                                    Content="{TemplateBinding TabControl.SelectedContent}" 
                                    ContentTemplate="{TemplateBinding TabControl.SelectedContentTemplate}" 
                                    ContentStringFormat="{TemplateBinding TabControl.SelectedContentStringFormat}" 
                                    ContentSource="SelectedContent" 
                                    Name="PART_SelectedContentHost" 
                                    Margin="{TemplateBinding Control.Padding}" 
                                    SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate DataType="{x:Type System:Uri}">
                    <Border BorderThickness="1" CornerRadius="3" Margin="2,0,2,2">
                        <local:WebBrowserControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5" SourceUri="{Binding}" />
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="TabItemStyle" TargetType="{x:Type TabItem}">
        <Setter Property="Header" Value="{Binding Host}"/>
        <Setter Property="ToolTip" Value="{Binding AbsoluteUri}" />
        <Setter Property="Content" Value="{Binding}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Border x:Name="Border"
                                Margin="0,0,0,0"
                                BorderThickness="1,1,1,0"
                                CornerRadius="3,3,0,0" MinWidth="70"
                                BorderBrush="{StaticResource TransparentBrushKey}"
                                Background="{StaticResource TransparentBrushKey}">
                        
                        <TextBlock x:Name="txtHeader" 
                                   Margin="5,0,5,0" 
                                   Text="{TemplateBinding Header}" 
                                   VerticalAlignment="Center" 
                                   HorizontalAlignment="Stretch" />

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState  x:Name="Unselected"/>
                                <VisualState x:Name="Selected"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.5" To="Normal" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" >
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource DisabledBorderLightColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100" />
                            <Setter Property="Background" TargetName="Border" Value="{StaticResource UltraLightGrayBrushKey}"/>
                            <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource GrayBlueBrushKey}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="providerMenuItem" TargetType="{x:Type MenuItem}">
        <Setter Property="IsCheckable" Value="True"/>
        <Setter Property="IsChecked" Value="True" />
        <Setter Property="Header" Value="{Binding Description}"/>
    </Style>
    
    
    <Style x:Key="MainViewContentControl" TargetType="{x:Type ContentControl}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContentControl}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <!-- Main menu -->
                        <Menu x:Name="mainMenu" Grid.Row="0">
                            <MenuItem Header="File">
                                <MenuItem Header="Exit" Command="{Binding ExitCommand}"/>
                            </MenuItem>
                            <MenuItem Header="PlugIns">
                                <!--<MenuItem Header="Create" Command="{Binding CreateHostCommand}"/>
                                <MenuItem Header="Clear" Command="{Binding ClearHostCommand}"/>-->
                                <MenuItem Header="Providers" ItemsSource="{Binding Plugins}" ItemContainerStyle="{StaticResource providerMenuItem}" />
                            </MenuItem>
                            <MenuItem Header="?">
                                <MenuItem Header="About" Command="{Binding AboutCommand}"/>
                            </MenuItem>
                        </Menu>

                        <!-- Search options -->
                        <Grid x:Name="options" Grid.Row="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <TextBlock Text="Player" Grid.Column="0" Grid.Row="0"  VerticalAlignment="Center" Margin="5"/>
                            <TextBlock Text="Solar System" Grid.Column="0" Grid.Row="1"  VerticalAlignment="Center" Margin="5"/>
                            
                            <TextBox x:Name="txtPlayer" Text="{Binding Player}" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Margin="5"/>
                            <ComboBox x:Name="txtSystem" SelectedValue="{Binding SelectedSolarSystem}" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Margin="5" IsEditable="True" ItemsSource="{Binding SolarSystems}"  />

                            <Button x:Name="btnSearch" IsEnabled="{Binding CanSearch}"  Command="{Binding SearchCommand}" Grid.Row="2" Grid.Column="1" Content="Search" Width="75" Height="23" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5"  />
                        </Grid>
                        
                        <!-- TabControl -->
                        <TabControl x:Name="tcResult" 
                                    Grid.Row="2" 
                                    BorderThickness="0" ItemsSource="{Binding SearchingUris}" 
                                    Style="{StaticResource SearchTabControlStyle}"
                                    ItemContainerStyle="{StaticResource TabItemStyle}">
                        </TabControl>
                            
                        <!-- Status bar -->
                        <StatusBar x:Name="mainStatusBar" Grid.Row="3">
                            <StatusBarItem Content="Search a solar system or a player intel"/>
                        </StatusBar>
                        
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>